package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VistaGenerarCalendario extends javax.swing.JFrame {
	private JPanel panGenerarCalendario;
	private JLabel lblFechaInicio;
	private JButton btnSalir;
	private JLabel lblTitulo;
	private JTable tblCalendario;
	private JScrollPane scpListado;
	private JButton btnGenerar;
	private JTextField txtFechaInicio;

	
	public VistaGenerarCalendario() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				panGenerarCalendario = new JPanel();
				getContentPane().add(panGenerarCalendario, BorderLayout.CENTER);
				panGenerarCalendario.setLayout(null);
				panGenerarCalendario.setPreferredSize(new java.awt.Dimension(501, 326));
				setTitle("Generar Calendario");
				{
					lblFechaInicio = new JLabel();
					panGenerarCalendario.add(lblFechaInicio);
					lblFechaInicio.setText("Fecha Inicio:");
					lblFechaInicio.setBounds(78, 63, 94, 16);
				}
				{
					txtFechaInicio = new JTextField();
					panGenerarCalendario.add(txtFechaInicio);
					txtFechaInicio.setBounds(178, 62, 106, 19);
				}
				{
					btnGenerar = new JButton();
					panGenerarCalendario.add(btnGenerar);
					btnGenerar.setText("Generar");
					btnGenerar.setBounds(336, 60, 107, 23);
				}
				
				{
					scpListado = new JScrollPane();
					panGenerarCalendario.add(scpListado);
					scpListado.setBounds(63, 109, 373, 165);
					{
						tblCalendario = new JTable();
						scpListado.setViewportView(tblCalendario);
					}
				}
				/*{
					TableModel tblCalendarioModel = 
							new DefaultTableModel(
									new String[][] { { "Fecha", "Equipo Local", "Equipo Visitante" } },
									new String[] { "Column 1", "Column 2","Column 2" });
					tblCalendario = new JTable();
					panGenerarCalendario.add(tblCalendario);
					tblCalendario.setModel(tblCalendarioModel);
					tblCalendario.setBounds(78, 110, 373, 90);
				}*/
				{
					lblTitulo = new JLabel();
					panGenerarCalendario.add(lblTitulo);
					lblTitulo.setText("Generar Calendario");
					lblTitulo.setBounds(177, 27, 140, 16);
				}
				{
					btnSalir = new JButton();
					panGenerarCalendario.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(348, 292, 88, 22);
				}
			}
			pack();
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void agregarListener(ActionListener accion){
		btnGenerar.addActionListener(accion);
		btnSalir.addActionListener(accion);
	}

	public JTextField getTxtFechaInicio() {
		return txtFechaInicio;
	}
	
	public void TirarMensajeError(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
	}

	public void setListado(AbstractTableModel abstractTableModel){
		//tblCalendario.setModel(new DefaultTableModel());
		tblCalendario.setModel(abstractTableModel);
	}
	
	

}
